﻿using System;
using UnityEngine;


    public class CharacterPanelView : MonoBehaviour
    {
        private void Start()
        {
            GenerateCharacterCell();
        }

        private void Update()
        {
            if (Input.GetMouseButtonDown(1))
            {
                Instantiate(PrefabManager.Instance.MenuPanel, StartGame.Instance.canvas).AddComponent<MenuPanelView>();
                Destroy(gameObject);
            }
        }

        private void GenerateCharacterCell()
        {
            foreach (var data in CharacterModel.Instance.CharacterDatas)
            {
                var go = Instantiate(PrefabManager.Instance.CharacterCell, transform.Find("CharacterParent"));
                go.AddComponent<CharacterCell>().CharacterData=data;
            }
        }
    }
